/*
    This source file is part of GeNa project.
    Copyright © GeNa project 2008
    For the latest info, see http://code.google.com/p/genaproject/ or  http://lumpyproject.forums-rpg.com

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Foobar is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar.  If not, see <http://www.gnu.org/licenses/>. */

#ifndef MANAGED_WINDOW_H_INCLUDED
#define MANAGED_WINDOW_H_INCLUDED


#ifndef WX_PCH_H_INCLUDED
#include "wx_pch.h"
#endif

#include <boost/archive/basic_archive.hpp>
#include <boost/serialization/base_object.hpp>
#include <boost/serialization/version.hpp>
using namespace boost::serialization;

class ManagedWindow
{
public:
    virtual ManagedWindow* clone(wxWindow* parent) = 0;
    virtual wxWindow* getWindow() = 0;
    virtual std::string getName() = 0;
};

class UnknowWindow : public ManagedWindow, public wxWindow
{
public:
    UnknowWindow(wxWindow* parent, wxString title) : wxWindow(parent, wxID_DEFAULT, wxDefaultPosition, wxDefaultSize)
    {
        SetBackgroundColour(*wxLIGHT_GREY);
    };

    template<class Archive> static ManagedWindow* createWindow(wxWindow* parent, Archive* ar)
    {
        UnknowWindow* wnd = new UnknowWindow(parent,wxT("unknow"));
        return wnd;
    }

    ManagedWindow* clone(wxWindow* parent)
    {
        return createWindow<void>(parent, NULL);
    }

    wxWindow* getWindow()
    {
        return this;
    }

    std::string getName()
    {
        return "UnknowWindow";
    }

    template<class Archive> void saveWindow( Archive* ar)
    {
    }
};

#endif // MANAGED_WINDOW_H_INCLUDED
